package cn.codesugar.videocache

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity

class MultipleVideosActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_multiple_videos)
        addVideoFragment("https://codesugar.cn/res/%E4%B9%90%E9%AB%98%E5%A4%A7%E7%94%B5%E5%BD%B1%E9%A2%84%E5%91%8A.mp4", R.id.videoContainer0)
        addVideoFragment("https://codesugar.cn/res/%E5%A5%A5%E8%BF%AAA4.mp4", R.id.videoContainer1)
        addVideoFragment("https://codesugar.cn/res/%E6%83%8A%E5%A5%87%E9%98%9F%E9%95%BF%E9%A2%84%E5%91%8A.mp4", R.id.videoContainer2)
    }

    private fun addVideoFragment(url: String, containerViewId: Int) {
        supportFragmentManager
            .beginTransaction()
            .add(containerViewId, VideoFragment(url))
            .commit()
    }
}